package com.itheima.dao;

import com.itheima.entiry.User;
import com.itheima.utils.DataSourceUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class UserDao {
    private JdbcTemplate template = new JdbcTemplate(DataSourceUtils.getDataSource());

    public List<User>findNameBuPrefix(String name){
        return template.query("select * from user where name like ?",
                new BeanPropertyRowMapper<>(User.class),
                name + "%");
    }
}
